package com.jisf.driver.utils;

import com.jisf.driver.exception.DrivingSchoolException;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Classname ResponseResult
 * @Description TODO
 * @Date 2022/4/18 15:58
 * @Created by jisf：【429627912@qq.com】
 */
@Component
public class WebUtil {

    public static String renderString(HttpServletResponse response, String json){
        try {
            response.setStatus(200);
            response.setContentType("application/json");
            response.setCharacterEncoding("utf-8");
            response.getWriter().println(json);
        }catch (IOException e){
            throw new DrivingSchoolException("response异常：", e);
        }
        return null;
    }

}
